home *** CD-ROM | disk | FTP | other *** search
/ Serving Financial Service…olutions Suite 1994 Fall / Serving Financial Services Solutions Suite 1994 Fall.iso / GS_Apps / License / update_issd6 < prev    next >
Text File  |  1994-12-14  |  5KB  |  168 lines

  1. #!/bin/csh -f
  2.  
  3. # Usage update_issd6
  4. # Last modified Sun Apr  3 17:11:28 EDT 1994
  5. # update_issd6 does the following:
  6. # 1. Check to see if issd6 is installed in /etc/inetd.conf
  7. #    If it is then comment it out.
  8. # 2. Kill all running locald6's and issd6's 
  9. # 3. Copy the latest issd6 and locald6 into old versions.
  10. # 4. Install issd6 in /etc/rc.local
  11. #
  12.  
  13.  
  14. # Standard system files
  15. set INETD_FILE = "/etc/inetd.conf"
  16. set RCLOCAL = "/etc/rc.local"
  17.  
  18. # Standard directory for Apps
  19. set STANDARD_DIRS = "/LocalApps"
  20.  
  21. # Current version of XNet License daemons you are using.
  22. set VERSION = 66
  23.  
  24. # List of commands
  25. set PS = "/bin/ps acux"
  26. set MV = "/bin/mv"
  27. set CP = "/bin/cp"
  28. set GREP = "/bin/grep"
  29. set KILL = "/bin/kill"
  30. set SED = "/bin/sed"
  31.  
  32. #********* 1 *************
  33.  
  34. echo ".....Checking ${INETD_FILE}....."
  35. set inet = `$GREP 300162/2 ${INETD_FILE}`
  36. if ($#inet != 0) then
  37.   $SED -e "/300162\/2/ d" < ${INETD_FILE} > ${INETD_FILE}.iss
  38.   $MV ${INETD_FILE} ${INETD_FILE}.preiss
  39.   $MV ${INETD_FILE}.iss ${INETD_FILE}
  40.   echo "${INETD_FILE} was altered to remove old versions of issd6"
  41.   echo "The old ${INETD_FILE} has been saved in ${INETD_FILE}.preiss"
  42.   echo "We recommend sending a signal to inetd to reread this file"
  43.   echo -n "If you do not wish to do this, please enter No --> "
  44.   set input = $<
  45.   if ($input != "No") then
  46.     echo  "Restarting inetd"
  47.     set pid = `$PS | $GREP inetd`
  48.     $KILL -HUP $pid[2]
  49.   endif
  50. endif
  51. echo ".....Done....."
  52. echo "------------------------------------------------------------------"
  53. echo ""
  54.  
  55.  
  56.  
  57. #********* 2 ****************************
  58. # Kill all existing locald6's and issd6's
  59.  
  60. set issd6 = `$PS | $GREP  issd6`
  61. set numissd6 = $#issd6
  62. if ($numissd6 != 0) then
  63.    echo ".....Killing issd6....."
  64. endif
  65.  
  66. while ($#issd6 != 0) 
  67.    echo -n "Kill pid $issd6[2] [y/n]"
  68.    set input = $<
  69.    if ($input == "y") then
  70.       $KILL -9 $issd6[2]
  71.    endif
  72.    set issd6 = `$PS | $GREP issd6`
  73. end
  74.  
  75. if ($numissd6 != 0) then
  76.    echo ".....Done....."
  77.    echo "------------------------------------------------------------------"
  78.    echo ""
  79. endif
  80.  
  81. set locald6 = `$PS | $GREP locald6`
  82. set numlocald6 = $#locald6
  83.  
  84. if ($numlocald6 != 0) then
  85.    echo ".....Killing locald6....."
  86. endif
  87.  
  88. while ($#locald6 != 0) 
  89.    echo -n "Kill pid $locald6[2] [y/n]"
  90.    set input = $<
  91.    if ($input == "y") then
  92.       $KILL -9 $locald6[2]
  93.    endif
  94.    set locald6 = `$PS | $GREP locald6`
  95. end
  96.  
  97. if ($numlocald6 != 0) then
  98.    echo ".....Done....."
  99.    echo "------------------------------------------------------------------"
  100.    echo ""
  101. endif
  102.  
  103. #**************** 3 ****************************
  104. # Replacing old versions of issd6 and locald6
  105.  
  106. echo "We recommend replacing old versions of the daemons issd6 and locald6"
  107. echo "to prevent conflicts from occurring"
  108. echo -n "Would you like us to do this automatically [y/n]  -->"
  109. set input = $<
  110. if ($input != "y") then
  111.    echo "Please replace any old versions of locald6 or issd6 with the"
  112.    echo "newer versions of locald6 and issd6"
  113.    echo "------------------------------------------------------------------"
  114.    echo ""
  115. else
  116.    echo ".....Replacing old versions of issd6 and locald6....."
  117.    echo -n "Please enter places other than $STANDARD_DIRS that I should look -->"
  118.    set input = $<
  119.    set DIRS = "$STANDARD_DIRS $input"
  120.    echo $DIRS
  121.    foreach dir ($DIRS)
  122.      if (-e $dir) then
  123.         find $dir -name locald6   -ok $CP ./locald6 {} \;
  124.         find $dir -name issd6     -ok $CP ./issd6 {} \;
  125.      else
  126.         echo "$dir does not exist"
  127.      endif
  128.    end
  129.    echo ".....Done....."
  130.    echo "------------------------------------------------------------------"
  131.    echo ""
  132. endif
  133.  
  134.  
  135. #******* This section actually installs issd6 *****************
  136. #******* 4 ****************************************************
  137.  
  138. if ($1 == "") then
  139.   set ISSDDIR = `pwd`
  140. else
  141.   set ISSDDIR = $1
  142. endif
  143. set grepresult = `$GREP issd6 ${RCLOCAL}`
  144. set num_words = $#grepresult
  145. if ($num_words != 0) then
  146.    set versiongrep = `$GREP XNet ${RCLOCAL}`
  147.    set oldversion = $versiongrep[2]
  148.    if ($oldversion < $VERSION) then
  149.       echo "Older version of issd6 already installed in ${RCLOCAL}"
  150.       echo "New version is backward compatible with older licensing"
  151.       echo -n "Replace old version with newer version? [y/n] -->"
  152.       set input = $<
  153.       if ($input == "y") then
  154.         echo ".....Installing issd6....."
  155.         $SED -e "/issd6/ d" -e "/$versiongrep/ d" < $RCLOCAL > ${RCLOCAL}.iss
  156.         $MV ${RCLOCAL} ${RCLOCAL}.preiss
  157.         $MV ${RCLOCAL}.iss ${RCLOCAL}
  158.     echo  "# $VERSION XNet Licensing--do not edit this line" >>& ${RCLOCAL}
  159.     echo  "${ISSDDIR}/issd6 -i" >>& ${RCLOCAL}
  160.         ${ISSDDIR}/issd6 -i
  161.         echo ".....Done....."
  162.       endif
  163.    else
  164.       echo "issd6 has already been installed"
  165.       exit
  166.    endif
  167. endif
  168.